home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / NEXTSUBA.C < prev    next >
Text File  |  1992-05-14  |  1KB  |  45 lines

  1. /************************************************************************************/
  2. /*    NextSubAndPosit                                                                    */
  3. /*                                                                                    */
  4. /*    This procedure returns the first available subscript int the windTbl, and the    */
  5. /*    next position which should be used for a new window.                            */
  6. /*                                                                                    */
  7. /*    Note.    This routine will not look at positions 0 or 1 in windTbl, since they    */
  8. /*    are reserved for the main window and a help window.                                */
  9. /************************************************************************************/
  10.  
  11. #include "MyHeaders.h"
  12.  
  13. int NextSubAndPosit (Point * nextPosit)
  14. {
  15.     int            NSRetCode = 0;
  16.     
  17.     windSub = 0;
  18.     for (j=2; j<windMax; j++)            /* find the first empty pointer in windTbl    */
  19.         {
  20.         if (windTbl[j].windPtr == 0)
  21.             {
  22.             windSub = j;
  23.             break;
  24.             }
  25.         }
  26.     if (windSub == 0)
  27.         {                                        /* if no empty pointer was found    */
  28.         NSRetCode = 1;                            /* set a bad return code            */
  29.         goto ENDING;                            /* and get out                        */
  30.         }
  31.     
  32.     
  33.     (*nextPosit).v +=20;                                        /* incr vertical position        */
  34.     if ((*nextPosit).v > (screenBits.bounds.bottom - 225))        /* if too far down                */
  35.         (*nextPosit).v = 40;                                    /* reset near top                */
  36.         
  37.     (*nextPosit).h +=10;                                        /* incr horizontal position        */
  38.     if ((*nextPosit).h > (screenBits.bounds.right - 345))        /* if too far right                */
  39.         (*nextPosit).h = 10;                                    /* reset near left                */
  40.  
  41.  
  42. ENDING:        
  43.     return NSRetCode;
  44. }
  45.